import LoginVue from "@/views/login.vue";
import { createRouter, createWebHistory } from "vue-router";
import layoutVue from "@/views/Layout.vue";
import roomManagement from "@/views/normal/roomManagement.vue";
import testVue from "@/views/normal/test.vue"
import clientVue from "@/views/normal/clientManagement.vue"
import orderVue from "@/views/normal/orderManagement.vue"
import foodVue from '@/views/root/foodManagement.vue';
import technicianVue from '@/views/root/technicianManagement.vue';
import typeVue from '@/views/root/typeManagement.vue';
import requestVue from '@/views/root/requestManagement.vue';
import infoVue from "@/views/user/Info.vue";
import avatarVue from "@/views/user/Avatar.vue";
import changePwdVue from "@/views/user/changePassword.vue";

//定义路由关系
const routes = [
    { path: "/login", component: LoginVue },
    {
        path: "/",
        component: layoutVue,

        //重定向
        redirect: '/normal/roomManagement',

        //子路由
        children: [
            // 普通权限
            { path: "/normal/roomManagement", component: roomManagement },
            { path: "/normal/test", component: testVue },
            { path: "/normal/clientManagement", component: clientVue },
            { path: "/normal/orderManagement", component: orderVue },
            // 管理员
            { path: "/root/foodManagement", component: foodVue },
            { path: "/root/technicianManagement", component: technicianVue },
            { path: "/root/typeManagement", component: typeVue },
            { path: "/root/requestManagement", component: requestVue },
            // 用户模块
            { path: "/user/info", component: infoVue },
            { path: "/user/avatar", component: avatarVue },
            { path: "/user/changePassword", component: changePwdVue },
        ]
    }
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
});

export default router;